package com.shop2cn.iapi.delivery.service;

import org.json.JSONObject;

import com.shop2cn.iapi.delivery.parameter.resp.VerifyBillNosResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*根据订单号获取对应的物流单号接口Call
*FreeMaker Template自动生成代码
*/
public class GetBillCodesByOrderIdsCall extends YmatouBaseCall {
	private static String opurl = "query/getBillCodesByOrderIds";

	public GetBillCodesByOrderIdsCall() {
		super(EnvSetup.getSystemUrl("shop2cn_pretrade"), opurl, "POST", "JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取BCode
	 * 
	 * @return
	 */
	public String getBCode() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("bcode");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 
	 * @return
	 */
	public VerifyBillNosResp getVerifyBillNosResp() {
		return (VerifyBillNosResp) FormatUtil.GSONToObject(getReturnData(),
				VerifyBillNosResp.class);
	}
}